package blog.controller.articles;

import blog.service.TagService;
import blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.websocket.server.PathParam;
import java.util.Enumeration;

@RestController
@RequestMapping("/tags")
public class TagsController {

    @Autowired
    private TagService tagService;

    // 热门标签
    @GetMapping("/hot")
    public Result hotTags(){
        int limit=3;

        return tagService.FindHotTags(limit);
    }

    // 找到所有文章标签 tags
    @GetMapping
    public Result findAll(){
        return tagService.findAll();
    }

    @GetMapping("/detail")
    public Result findAllDetails(){
        return tagService.findAll();
    }

    @GetMapping ("detail/{id}")
        public Result findDetailById(@PathVariable("id") Long id){
        return tagService.findDetailById(id);
    }

}
